﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Xml;
using System.Collections;

namespace MyCollections
{
    public partial class selectTypeToDisplay : Form
    {
        public selectTypeToDisplay()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            //FIXME: get Location XML from xmlconfig

            string pathxml = "XMLData\\db_movies.xml";

            // DATAGRID

            DataSet objDataSet = new DataSet();
            objDataSet.ReadXml(pathxml,XmlReadMode.Auto);
            dg_result.SetDataBinding(objDataSet,"Filmes");

            


        }

        private XmlDocument getXML(string filepath)
        {
            XmlDocument doc = new XmlDocument();
            doc.Load(filepath);
            return doc;
        }

        private void button2_Click(object sender, EventArgs e)
        {
            webbrowser obj = new webbrowser();
            //obj.MdiParent = this;
            obj.Show();
        }

        private void dg_result_DoubleClick(object sender, EventArgs e)
        {            
            DataGridCell cc= dg_result.CurrentCell;
            object data = dg_result.DataSource;
            int index = int.Parse((string)this.dg_result[cc.RowNumber, 0]);

            DetailsMovie obj = new DetailsMovie(index);
            obj.MdiParent = this.MdiParent;
            obj.Show();

        }
    }
}